// 封装获取频道列表的逻辑
import { useState, useEffect } from 'react'
import http from "@/utils/http";
export default function useChannel() {
    const [channelList, setChannelList] = useState([])

    useEffect(() => {
        function getChannelList() {
            http.get("/channels").then((res) => {
                setChannelList(res.data.channels);
            });
        }
        getChannelList()
    }, [])

    return { channelList, setChannelList }
}